package com.example.androidtest;

import android.R.raw;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class RegisterActivity extends Activity implements OnClickListener{
	private EditText et_user1;
	private EditText et_password1;
	private Button btn_next;
	private Button btn_back;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.register);
		et_user1 = (EditText) findViewById(R.id.et_user1);
		et_password1 = (EditText) findViewById(R.id.et_password1);
		btn_back  = (Button) findViewById(R.id.btn_back);
		btn_next = (Button) findViewById(R.id.btn_next);
		Intent intent = getIntent();
		String str = intent.getStringExtra("user");
		et_user1.setText(str);
		btn_next.setOnClickListener(this);
		btn_back.setOnClickListener(this);
//		findViewById(R.id.btnNextPage).setOnClickListener(new OnClickListener() {
//			
//			@Override
//			public void onClick(View v) {
//				Intent intent = new Intent(RegisterActivity.this,FirstActivity.class);
//				startActivity(intent);
//				overridePendingTransition(R.anim.out_to_left, R.anim.in_from_right);
//			}
//		});
//		findViewById(R.id.btnBack).setOnClickListener(new OnClickListener() {
//			
//			@Override
//			public void onClick(View v) {
//				Intent intent = new Intent(RegisterActivity.this,MainActivity.class);
//				startActivity(intent);
//				overridePendingTransition(R.anim.out_to_right, R.anim.in_from_left);				
//			}
//		});
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.btn_next:
			Intent intent  =new Intent(RegisterActivity.this,MainActivity.class);
			String str = et_user1.getText().toString();
			intent.putExtra("userback", str);
			String str1 = et_password1.getText().toString();
			intent.putExtra("passwordback", str1);
			setResult(200, intent);
			finish();
			break;
		case R.id.btn_back:
			Log.i("aaaa", "1111111111111");
			Intent intent2 = new Intent(RegisterActivity.this,MainActivity.class);
			startActivity(intent2);
			break;
		default:
			break;
		}
	}
}
